//TexturedFullScreenQuadFX.h
//Created 27/06/13
//Created By Daniel Bowler
//
//This effect will render a full screen quad maped with a texture. Can be used
//to render the SRVs of our GBuffer (Eg, the normals RTV in our GBuffer)

#pragma once

#include "AbstractFX.h"

class TexturedFullScreenQuadFX : public AbstractFX
{
	//The shader Manager will be responsable for creating the shaders. 
	friend ShaderManager;

public:
	//Vertex structure for this effect.
	struct PosTex
	{
		XMFLOAT3 Pos;
		XMFLOAT2 Tex;
	};

	//Set shader resource
	void SetShaderResource(ID3D11ShaderResourceView* tex);
	//For MSAA enabled textures (eg, Depth Buffer)
	void SetShaderResourceMSAA(ID3D11ShaderResourceView* tex);
	//Sets buffers
	void SetUAVFloatBuffer(ID3D11UnorderedAccessView* buff);
	void SetSRVUint2Buffer(ID3D11ShaderResourceView* buff);

	//Set projection matrix
	void SetProj(CXMMATRIX& proj);
	
	//Set RT dimentions
	void SetRTDimentions(float width, float height);
private:
	//We dont want the user to directly create one of these (They work with
	//pointers), so hide the constructor/destructors. 
	TexturedFullScreenQuadFX(ID3D11Device* device);
	~TexturedFullScreenQuadFX();
	//Disable the copy constructor and the = operator
	TexturedFullScreenQuadFX(const TexturedFullScreenQuadFX& other);
	TexturedFullScreenQuadFX& operator = (const TexturedFullScreenQuadFX& other);

	//Override these to aid creating our shader.
	void InitInputLayout(ID3D11Device* device);
	void InitShaderVariablePointers();
private:
	//Shader variables - our textures and buffers
	ID3DX11EffectShaderResourceVariable* texture;
	ID3DX11EffectShaderResourceVariable* textureMSAA;
	ID3DX11EffectUnorderedAccessViewVariable* uavBuffFloatVar;
	ID3DX11EffectShaderResourceVariable* srvBufferVar;
	//Render target size
	ID3DX11EffectScalarVariable* rtWidthVar;
	ID3DX11EffectScalarVariable* rtHeightVar;

	//Proj matrix
	ID3DX11EffectMatrixVariable* projVar;
};